<?php

class BackendAdministratorForm extends AdministratorForm
{
  public function configure()
  {
    unset(
      $this['created_at'],
      $this['updated_at']
    );
    
    $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password'] = new sfValidatorString(array(
      'min_length' => 6, 
      'max_length' => 255,
      'required' => $this->isNew()
    ));
    
    $this->widgetSchema['password_confirm'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password_confirm'] = new sfValidatorPass();
    
    $this->mergePostValidator(
      new sfValidatorSchemaCompare(
        'password',
        sfValidatorSchemaCompare::EQUAL,
        'password_confirm',
        array(), array('invalid' => '两次输入的密码不一致')
      )
    );
  }
}